/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('hitsdb', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateHiTSDBInstanceRequest {
  appKey?: string(name='AppKey', description='The ID of the zone in which you want to create the instance.', example='None'),
  diskCategory?: string(name='DiskCategory', description='The ID of the request.', example='cloud_ssd'),
  duration?: string(name='Duration', description='The disk type of TSDB for InfluxDB️®️.

*   cloud_efficiency: ultra disk
*   cloud_ssd: standard SSD.
*   cloud_essd: ESSD cloud_auto: ESSD AutoPL disk', example='1'),
  instanceAlias?: string(name='InstanceAlias', description='The type of the instance.', example='tsdb_test'),
  instanceClass?: string(name='InstanceClass', description='The storage capacity of the instance. Unit: GB.

This parameter is required.', example='tsdb.1x.basic'),
  instanceStorage?: string(name='InstanceStorage', description='The billing method of the instance. Valid values:

*   PREPAY: subscription
*   POSTPAY: pay-as-you-go

This parameter is required.', example='50'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  payType?: string(name='PayType', description='The ID of the VPC in which the instances reside.

This parameter is required.', example='PREPAY'),
  pricingCycle?: string(name='PricingCycle', description='The subscription duration of the instance.

*   If PricingCycle is set to Month, set this parameter to an integer that ranges from 1 to 9.
*   If PricingCycle is set to Year, set this parameter to an integer that ranges from 1 to 3.', example='Month'),
  regionId?: string(name='RegionId', description='A reserved parameter.

This parameter is required.', example='cn-shanghai'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
  VPCId?: string(name='VPCId', description='The ID of the vSwitch to which the instance connects to.

This parameter is required.', example='vpc-wz9ydz3vg93s1ozsd****'),
  vSwitchId?: string(name='VSwitchId', description='The unit of the subscription duration of the instance. Valid values:

*   Month
*   Year

This parameter is required.', example='vsw-wz9kv78f9cp47yadu****'),
  zoneId?: string(name='ZoneId', description='The name of the instance .

This parameter is required.', example='cn-shanghai-b'),
}

model CreateHiTSDBInstanceResponseBody = {
  instanceId?: string(name='InstanceId', description='The ID of the order.', example='ts-wz99vz6u8jg39****'),
  orderId?: long(name='OrderId', description='Creates a Time Series Database (TSDB) instance.', example='211110656240000'),
  requestId?: string(name='RequestId', description='The ID of the instance.', example='587BCA54-50DA-4885-ADE9-80A848339151'),
}

model CreateHiTSDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateHiTSDBInstanceResponseBody(name='body'),
}

/**
 * @param request CreateHiTSDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateHiTSDBInstanceResponse
 */
async function createHiTSDBInstanceWithOptions(request: CreateHiTSDBInstanceRequest, runtime: Util.RuntimeOptions): CreateHiTSDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appKey)) {
    query['AppKey'] = request.appKey;
  }
  if (!Util.isUnset(request.diskCategory)) {
    query['DiskCategory'] = request.diskCategory;
  }
  if (!Util.isUnset(request.duration)) {
    query['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.instanceAlias)) {
    query['InstanceAlias'] = request.instanceAlias;
  }
  if (!Util.isUnset(request.instanceClass)) {
    query['InstanceClass'] = request.instanceClass;
  }
  if (!Util.isUnset(request.instanceStorage)) {
    query['InstanceStorage'] = request.instanceStorage;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.payType)) {
    query['PayType'] = request.payType;
  }
  if (!Util.isUnset(request.pricingCycle)) {
    query['PricingCycle'] = request.pricingCycle;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  if (!Util.isUnset(request.VPCId)) {
    query['VPCId'] = request.VPCId;
  }
  if (!Util.isUnset(request.vSwitchId)) {
    query['VSwitchId'] = request.vSwitchId;
  }
  if (!Util.isUnset(request.zoneId)) {
    query['ZoneId'] = request.zoneId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateHiTSDBInstance',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateHiTSDBInstanceRequest
 * @return CreateHiTSDBInstanceResponse
 */
async function createHiTSDBInstance(request: CreateHiTSDBInstanceRequest): CreateHiTSDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createHiTSDBInstanceWithOptions(request, runtime);
}

model DeleteHiTSDBInstanceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='ts-ufxxxxxxxxxxxxx'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
}

model DeleteHiTSDBInstanceResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='1556DCB0-043A-4444-8BD9-CF4A68E7EE64'),
}

model DeleteHiTSDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteHiTSDBInstanceResponseBody(name='body'),
}

/**
 * @summary Deletes a Time Series Database (TSDB) instance.
 *
 * @param request DeleteHiTSDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteHiTSDBInstanceResponse
 */
async function deleteHiTSDBInstanceWithOptions(request: DeleteHiTSDBInstanceRequest, runtime: Util.RuntimeOptions): DeleteHiTSDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteHiTSDBInstance',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a Time Series Database (TSDB) instance.
 *
 * @param request DeleteHiTSDBInstanceRequest
 * @return DeleteHiTSDBInstanceResponse
 */
async function deleteHiTSDBInstance(request: DeleteHiTSDBInstanceRequest): DeleteHiTSDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteHiTSDBInstanceWithOptions(request, runtime);
}

model DescribeHiTSDBInstanceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='ts-ufxxxxxxxxxx'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
}

model DescribeHiTSDBInstanceResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  autoRenew?: string(name='AutoRenew', description='Indicates whether auto-renewal is enabled for the instance that uses the subscription billing method.', example='true'),
  chargeType?: string(name='ChargeType', description='The billing method of the instance. Valid values: PREPAY and POSTPAY. The PREPAY value indicates the subscription billing method. The POSTPAY value indicates the pay-as-you-go billing method.', example='PREPAY'),
  connectionString?: string(name='ConnectionString', description='The endpoint of the database.', example='ts-xxxxxxxxxxxxxxxxx.hitsdb.tsdb.aliyuncs.com:8242'),
  cpuNumber?: string(name='CpuNumber', description='The number of CPU cores of the instance.', example='2'),
  createTime?: long(name='CreateTime', description='The timestamp when the instance is created.', example='1603426323000'),
  diskCategory?: string(name='DiskCategory', description='The disk type of the instance. For a TSDB for InfluxDB®️ instance, the valid values are cloud_efficiency and cloud_ssd. The cloud_efficiency value indicates ultra disks. The cloud_ssd value indicates standard SSDs.', example='cloud_efficiency'),
  engineType?: string(name='EngineType', description='The engine type of the instance. Valid values: tsdb_tsdb, tsdb_influxdb, and tsdb1.5. The tsdb_tsdb value indicates the OpenTSDB engine. The tsdb_influxdb value indicates the InfluxDB®️ engine. The tsdb1.5 value indicates the tsdb1.5 engine.', example='tsdb_tsdb'),
  expiredTime?: long(name='ExpiredTime', description='The timestamp when the instance expires. This parameter is returned only when the instance uses the subscription billing method.', example='1611417600000'),
  gmtCreated?: string(name='GmtCreated', description='The time when the instance is created. The time is in the yyyy-MM-dd HH:mm:ss format.', example='2020-11-16 16:22:56'),
  gmtExpire?: string(name='GmtExpire', description='The time when the instance expires. This parameter is returned only when the instance uses the subscription billing method. The time is in the yyyy-MM-dd HH:mm:ss format.', example='2020-12-17 00:00:00'),
  instanceAlias?: string(name='InstanceAlias', description='The name of the instance.', example='tsdb_test'),
  instanceClass?: string(name='InstanceClass', description='The type of the instance.', example='tsdb.96x.large_lindorm'),
  instanceDescription?: string(name='InstanceDescription', description='The description of the instance.', example='test'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.', example='ts-xxxxxxxxxxxxxxxxx'),
  instanceStatus?: string(name='InstanceStatus', description='The status of the instance. Valid values: ACTIVATION, CREATING, NET_CREATING, CLASS_CHANGING, LOCKED, and DELETED. ACTIVATION indicates that the instance is running. CREATING indicates that the instance is being created. NET_CREATING indicates that a network connection to the instance is being created. CLASS_CHANGING indicates that the configuration of the instance is being modified. LOCKED indicates that the instance is locked. DELETED indicates that the instance is deleted.', example='ACTIVATION'),
  instanceStorage?: string(name='InstanceStorage', description='The storage capacity of the instance. Unit: GB.', example='320'),
  instanceTps?: string(name='InstanceTps', description='The transactions per second (TPS) of the instance. Unit: TPS.', example='960000'),
  maxTimelineLimit?: string(name='MaxTimelineLimit', description='The number of time series supported by the instance. This parameter is returned only if the instance is a TSDB instance.', example='2400000'),
  memSize?: string(name='MemSize', description='The memory size of the instance. This parameter is returned only if the instance is a TSDB for InfluxDB®️ instance.', example='8'),
  networkType?: string(name='NetworkType', description='The network type of the instance.', example='VPC'),
  paymentType?: string(name='PaymentType', description='The billing method of the instance. Valid values: PREPAY and POSTPAY. The PREPAY value indicates the subscription billing method. The POSTPAY value indicates the pay-as-you-go billing method.', example='PREPAY'),
  publicConnectionString?: string(name='PublicConnectionString', description='The public endpoint of the instance. You can use the public endpoint to access the instance over the Internet.', example='ts-xxxxxxxxxxxxxxxxx.influxdata.rds.aliyuncs.com:3242'),
  regionId?: string(name='RegionId', description='The ID of the region in which the instance is located.', example='cn-shanghai'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='8D156621-1FCB-414A-BD29-361C3CA4DD56'),
  securityIpList?: [ 
    {
      ip?: string(name='Ip', description='The IP address in the whitelist of the instance.', example='0.0.0.0/0'),
    }
  ](name='SecurityIpList', description='The IP address whitelist of the instance.'),
  series?: int32(name='Series', description='The edition of the TSDB for InfluxDB®️ instance. Valid values: 0 and 1. The 0 value indicates the Standard Edition. The 1 value indicates the High-availability Edition.', example='1'),
  status?: string(name='Status', description='The status of the instance. Valid values: ACTIVATION, CREATING, NET_CREATING, CLASS_CHANGING, LOCKED, and DELETED. ACTIVATION indicates that the instance is running. CREATING indicates that the instance is being created. NET_CREATING indicates that a network connection to the instance is being created. CLASS_CHANGING indicates that the configuration of the instance is being modified. LOCKED indicates that the instance is locked. DELETED indicates that the instance is deleted.', example='ACTIVATION'),
  vpcId?: string(name='VpcId', description='The ID of the VPC.', example='vpc-xxxxxxxxxxxxxxxxxxxxx'),
  vswitchId?: string(name='VswitchId', description='The ID of the vSwitch to which the instance connects.', example='vsw-xxxxxxxxxxxxxxxxxxxxx'),
  zoneId?: string(name='ZoneId', description='The ID of the zone in which the instance is deployed.', example='cn-shanghai-f'),
}

model DescribeHiTSDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHiTSDBInstanceResponseBody(name='body'),
}

/**
 * @summary Queries the details about a Time Series Database (TSDB) instance.
 *
 * @param request DescribeHiTSDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHiTSDBInstanceResponse
 */
async function describeHiTSDBInstanceWithOptions(request: DescribeHiTSDBInstanceRequest, runtime: Util.RuntimeOptions): DescribeHiTSDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeHiTSDBInstance',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details about a Time Series Database (TSDB) instance.
 *
 * @param request DescribeHiTSDBInstanceRequest
 * @return DescribeHiTSDBInstanceResponse
 */
async function describeHiTSDBInstance(request: DescribeHiTSDBInstanceRequest): DescribeHiTSDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeHiTSDBInstanceWithOptions(request, runtime);
}

model DescribeHiTSDBInstanceListRequest {
  engineType?: string(name='EngineType', description='The ID of the request.', example='tsdb_tsdb'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  pageNumber?: int32(name='PageNumber', description='The number of instances to return on each page.

This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='The engine type of the instances that you want to query. Valid values: tsdb_tsdb and tsdb_influxdb. The tsdb_tsdb value indicates the OpenTSDB engine. The tsdb_influxdb value indicates the InfluxDB®️ engine.

This parameter is required.', example='30'),
  queryStr?: string(name='QueryStr', description='The states of the instances you want to query. Specify this parameter in the JSON format. The InstanceStatus parameter enumerates the instances of the specified states.', example='test'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
  statusList?: string(name='StatusList', description='The number of the page to return.', example='["ACTIVATION", "DELETED"]'),
}

model DescribeHiTSDBInstanceListResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  instanceList?: [ 
    {
      chargeType?: string(name='ChargeType', description='The user ID.', example='POSTPAY'),
      createTime?: long(name='CreateTime', description='The billing method of the instance. Valid values: PREPAY and POSTPAY. The PREPAY value indicates the subscription billing method. The POSTPAY value indicates the pay-as-you-go billing method.', example='1603426323000'),
      engineType?: string(name='EngineType', description='The ID of the vSwitch.', example='tsdb_tsdb'),
      expiredTime?: long(name='ExpiredTime', description='The ID of the zone in which the instance is deployed.', example='1611417600000'),
      gmtCreated?: string(name='GmtCreated', description='The name of the instance.', example='2020-11-16 16:22:56'),
      gmtExpire?: string(name='GmtExpire', description='Queries the list of Time Series Database (TSDB) instances.', example='2020-12-17 00:00:00'),
      instanceAlias?: string(name='InstanceAlias', description='The transactions per second (TPS) of the instance. Unit: TPS.', example='test_tsdb'),
      instanceClass?: string(name='InstanceClass', description='The timestamp when the instance was created.', example='tsdb.1x.basic'),
      instanceDescription?: string(name='InstanceDescription', description='The region ID of the instance.', example='test'),
      instanceId?: string(name='InstanceId', description='Indicates whether the instance is locked. Valid values: 0 and 1. The value 0 indicates that the instance is not locked. The value 1 indicates that the instance is locked.', example='ts-xxxxxxxxxxxxxxxxx'),
      instanceStatus?: string(name='InstanceStatus', description='The time when the instance expires. This parameter is returned only when the instance uses the subscription billing method. The time is in the yyyy-MM-dd HH:mm:ss format.', example='ACTIVATION'),
      instanceStorage?: string(name='InstanceStorage', description='The network type of the instance. The VPC value indicates a virtual private cloud (VPC).', example='50'),
      instanceTps?: string(name='InstanceTps', description='The timestamp when the instance expires. This parameter is returned only when the instance uses the subscription billing method.', example='960000'),
      lockMode?: string(name='LockMode', description='The description of the instance.', example='0'),
      maxSeriesPerDatabase?: string(name='MaxSeriesPerDatabase', description='The engine type of the instance. Valid values: tsdb_tsdb and tsdb_influxdb. The tsdb_tsdb value indicates the OpenTSDB engine. The tsdb_influxdb value indicates the InfluxDB®️ engine.', example='10000'),
      networkType?: string(name='NetworkType', description='The ID of the instance.', example='VPC'),
      paymentType?: string(name='PaymentType', description='The maximum number of time series that can be stored in a database.', example='PREPAY'),
      regionId?: string(name='RegionId', description='The time when the instance was created. The time is in the yyyy-MM-dd HH:mm:ss format.', example='cn-hangzhou'),
      status?: string(name='Status', description='The ID of the VPC.', example='ACTIVATION'),
      userId?: string(name='UserId', description='The storage capacity of the instance. Unit: GB.', example='1000000000000000'),
      vpcId?: string(name='VpcId', description='The billing method of the instance. Valid values: PREPAY and POSTPAY. The PREPAY value indicates the subscription billing method. The POSTPAY value indicates the pay-as-you-go billing method.', example='vpc-bp1xxxxxxxxxxxxxxxxxx'),
      vswitchId?: string(name='VswitchId', description='The type of the instance.', example='vsw-bp1xxxxxxxxxxxxxxxxxx'),
      zoneId?: string(name='ZoneId', description='The state of the instance. The value of this parameter is an enumerated string.', example='cn-hongkong-b'),
    }
  ](name='InstanceList', description='The status of the instance. Valid values: ACTIVATION, CREATING, NET_CREATING, CLASS_CHANGING, LOCKED, and DELETED. ACTIVATION: The instance is running. CREATING: The instance is being created. NET_CREATING: A network connection is being established. CLASS_CHANGING: The configuration of the instance is being modified. LOCKED: The instance is locked. DELETED: The instance is deleted.'),
  pageNumber?: int32(name='PageNumber', description='The number of instances returned on each page.', example='1'),
  pageSize?: int32(name='PageSize', description='The total number of returned instances.', example='20'),
  requestId?: string(name='RequestId', description='The page number of the returned page.', example='0A7153E4-8354-497E-87E5-5D0EBEF5AEB1'),
  total?: int32(name='Total', description='The list of queried instances.', example='10'),
}

model DescribeHiTSDBInstanceListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHiTSDBInstanceListResponseBody(name='body'),
}

/**
 * @param request DescribeHiTSDBInstanceListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHiTSDBInstanceListResponse
 */
async function describeHiTSDBInstanceListWithOptions(request: DescribeHiTSDBInstanceListRequest, runtime: Util.RuntimeOptions): DescribeHiTSDBInstanceListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.engineType)) {
    query['EngineType'] = request.engineType;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.queryStr)) {
    query['QueryStr'] = request.queryStr;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  if (!Util.isUnset(request.statusList)) {
    query['StatusList'] = request.statusList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeHiTSDBInstanceList',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeHiTSDBInstanceListRequest
 * @return DescribeHiTSDBInstanceListResponse
 */
async function describeHiTSDBInstanceList(request: DescribeHiTSDBInstanceListRequest): DescribeHiTSDBInstanceListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeHiTSDBInstanceListWithOptions(request, runtime);
}

model DescribeHiTSDBInstanceSecurityIpListRequest {
  groupName?: string(name='GroupName', description='The ID of the request.', example='test_group'),
  instanceId?: string(name='InstanceId', description='The name of the group to which the instance belongs. The group name can contain only letters, digits, and underscores (_).

This parameter is required.', example='ts-xxxxxxxxxxxxxxxxx'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
}

model DescribeHiTSDBInstanceSecurityIpListResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  requestId?: string(name='RequestId', description='The IP address whitelist of the instance.', example='F2DFDC0B-FE4F-4696-9FD1-2EFDEE8D6C7C'),
  securityIpList?: [ 
    {
      ip?: string(name='Ip', description='auditing', example='0.0.0.0/0'),
    }
  ](name='SecurityIpList', description='The IP address in the whitelist.'),
}

model DescribeHiTSDBInstanceSecurityIpListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHiTSDBInstanceSecurityIpListResponseBody(name='body'),
}

/**
 * @param request DescribeHiTSDBInstanceSecurityIpListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHiTSDBInstanceSecurityIpListResponse
 */
async function describeHiTSDBInstanceSecurityIpListWithOptions(request: DescribeHiTSDBInstanceSecurityIpListRequest, runtime: Util.RuntimeOptions): DescribeHiTSDBInstanceSecurityIpListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeHiTSDBInstanceSecurityIpList',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeHiTSDBInstanceSecurityIpListRequest
 * @return DescribeHiTSDBInstanceSecurityIpListResponse
 */
async function describeHiTSDBInstanceSecurityIpList(request: DescribeHiTSDBInstanceSecurityIpListRequest): DescribeHiTSDBInstanceSecurityIpListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeHiTSDBInstanceSecurityIpListWithOptions(request, runtime);
}

model DescribeRegionsRequest {
  acceptLanguage?: string(name='AcceptLanguage', description='The language of the values to return. Valid values:

*   zh-CN: Chinese
*   en-US: English
*   ja: Japanese

Default value: en-US', example='zh-CN'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
}

model DescribeRegionsResponseBody = {
  regions?: {
    region?: [ 
    {
      localName?: string(name='LocalName', description='The name of the region.', example='China (Hangzhou)'),
      regionEndpoint?: string(name='RegionEndpoint', description='The endpoint of the region.', example='hitsdb.aliyuncs.com'),
      regionId?: string(name='RegionId', description='The ID of the region.', example='cn-hangzhou'),
    }
  ](name='Region')
  }(name='Regions', description='The collection of regions.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='BDDB1954-002B-4249-B2DF-2CDDA0259668'),
}

model DescribeRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRegionsResponseBody(name='body'),
}

/**
 * @summary Queries the regions in which Time Series Database (TSDB) instances can be deployed.
 *
 * @param request DescribeRegionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRegionsResponse
 */
async function describeRegionsWithOptions(request: DescribeRegionsRequest, runtime: Util.RuntimeOptions): DescribeRegionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.acceptLanguage)) {
    query['AcceptLanguage'] = request.acceptLanguage;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRegions',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the regions in which Time Series Database (TSDB) instances can be deployed.
 *
 * @param request DescribeRegionsRequest
 * @return DescribeRegionsResponse
 */
async function describeRegions(request: DescribeRegionsRequest): DescribeRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRegionsWithOptions(request, runtime);
}

model DescribeZonesRequest {
  language?: string(name='Language', description='The ID of the request.', example='zh_CN'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
}

model DescribeZonesResponseBody = {
  requestId?: string(name='RequestId', description='The list of available zones.', example='F67BFFF3-F5C2-45B5-9C28-6E4A1E51449B'),
  zoneList?: {
    zoneModel?: [ 
    {
      localName?: string(name='LocalName', description='Shanghai Zone B', example='Queries zones that are available in a specified region.'),
      zoneId?: string(name='ZoneId', description='The name of the zone', example='cn-shanghai-b'),
    }
  ](name='ZoneModel')
  }(name='ZoneList', description='The ID of the zone.'),
}

model DescribeZonesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeZonesResponseBody(name='body'),
}

/**
 * @param request DescribeZonesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeZonesResponse
 */
async function describeZonesWithOptions(request: DescribeZonesRequest, runtime: Util.RuntimeOptions): DescribeZonesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.language)) {
    query['Language'] = request.language;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeZones',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeZonesRequest
 * @return DescribeZonesResponse
 */
async function describeZones(request: DescribeZonesRequest): DescribeZonesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeZonesWithOptions(request, runtime);
}

model ModifyHiTSDBInstanceClassRequest {
  instanceClass?: string(name='InstanceClass', description='The storage capacity of the instance. Unit: GB.

This parameter is required.', example='tsdb.1x.basic'),
  instanceId?: string(name='InstanceId', description='The type of the instance.

This parameter is required.', example='ts-xxxxxxxxxxxxxxxxx'),
  instanceStorage?: string(name='InstanceStorage', description='The ID of the request.

This parameter is required.', example='500'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
}

model ModifyHiTSDBInstanceClassResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  requestId?: string(name='RequestId', description='Modifies the type of a Time Series Database (TSDB) instance.', example='57540985-3C11-4588-96FD-93413C6282EF'),
}

model ModifyHiTSDBInstanceClassResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyHiTSDBInstanceClassResponseBody(name='body'),
}

/**
 * @param request ModifyHiTSDBInstanceClassRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyHiTSDBInstanceClassResponse
 */
async function modifyHiTSDBInstanceClassWithOptions(request: ModifyHiTSDBInstanceClassRequest, runtime: Util.RuntimeOptions): ModifyHiTSDBInstanceClassResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceClass)) {
    query['InstanceClass'] = request.instanceClass;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceStorage)) {
    query['InstanceStorage'] = request.instanceStorage;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyHiTSDBInstanceClass',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyHiTSDBInstanceClassRequest
 * @return ModifyHiTSDBInstanceClassResponse
 */
async function modifyHiTSDBInstanceClass(request: ModifyHiTSDBInstanceClassRequest): ModifyHiTSDBInstanceClassResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyHiTSDBInstanceClassWithOptions(request, runtime);
}

model ModifyHiTSDBInstanceSecurityIpListRequest {
  groupName?: string(name='GroupName', description='auditing', example='test_group'),
  instanceId?: string(name='InstanceId', description='The name of the group to which the instance belongs. The group name can contain only letters, digits, and underscores (_).

This parameter is required.', example='ts-ufxxxxxxxxxxxxxx'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityIpList?: string(name='SecurityIpList', description='The ID of the request.

This parameter is required.', example='[“127.0.0.1”, “192.168.0.1/24”]'),
  securityToken?: string(name='SecurityToken'),
}

model ModifyHiTSDBInstanceSecurityIpListResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  requestId?: string(name='RequestId', description='Configures the whitelist of a Time Series Database (TSDB) instance. The IP addresses in the whitelist are allowed to connect to the instance.', example='1556DCB0-043A-4444-8BD9-CF4A68E7EE64'),
}

model ModifyHiTSDBInstanceSecurityIpListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyHiTSDBInstanceSecurityIpListResponseBody(name='body'),
}

/**
 * @param request ModifyHiTSDBInstanceSecurityIpListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyHiTSDBInstanceSecurityIpListResponse
 */
async function modifyHiTSDBInstanceSecurityIpListWithOptions(request: ModifyHiTSDBInstanceSecurityIpListRequest, runtime: Util.RuntimeOptions): ModifyHiTSDBInstanceSecurityIpListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityIpList)) {
    query['SecurityIpList'] = request.securityIpList;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyHiTSDBInstanceSecurityIpList',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyHiTSDBInstanceSecurityIpListRequest
 * @return ModifyHiTSDBInstanceSecurityIpListResponse
 */
async function modifyHiTSDBInstanceSecurityIpList(request: ModifyHiTSDBInstanceSecurityIpListRequest): ModifyHiTSDBInstanceSecurityIpListResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyHiTSDBInstanceSecurityIpListWithOptions(request, runtime);
}

model RenameHiTSDBInstanceAliasRequest {
  instanceAlias?: string(name='InstanceAlias', description='Instance Alias

This parameter is required.', example='vme'),
  instanceId?: string(name='InstanceId', description='Instance ID

This parameter is required.', example='ts-ufxxxxxxxxxxxxxx'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
}

model RenameHiTSDBInstanceAliasResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  requestId?: string(name='RequestId', description='Request ID', example='1556DCB0-043A-4444-8BD9-CF4A68E7EE64'),
}

model RenameHiTSDBInstanceAliasResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RenameHiTSDBInstanceAliasResponseBody(name='body'),
}

/**
 * @summary Invoke RenameHiTSDBInstanceAlias to modify the instance alias.
 *
 * @param request RenameHiTSDBInstanceAliasRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RenameHiTSDBInstanceAliasResponse
 */
async function renameHiTSDBInstanceAliasWithOptions(request: RenameHiTSDBInstanceAliasRequest, runtime: Util.RuntimeOptions): RenameHiTSDBInstanceAliasResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceAlias)) {
    query['InstanceAlias'] = request.instanceAlias;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RenameHiTSDBInstanceAlias',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Invoke RenameHiTSDBInstanceAlias to modify the instance alias.
 *
 * @param request RenameHiTSDBInstanceAliasRequest
 * @return RenameHiTSDBInstanceAliasResponse
 */
async function renameHiTSDBInstanceAlias(request: RenameHiTSDBInstanceAliasRequest): RenameHiTSDBInstanceAliasResponse {
  var runtime = new Util.RuntimeOptions{};
  return renameHiTSDBInstanceAliasWithOptions(request, runtime);
}

model RenewTSDBInstanceRequest {
  duration?: int32(name='Duration', description='The subscription duration of the instance. If you set PricingCycle to Month, set Duration to an integer that ranges from 1 to 9. If you set PricingCycle to Year, set Duration to an integer that ranges from 1 to 3.

This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='ts-xxxxxxxxxxxxxxxxx'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  pricingCycle?: string(name='PricingCycle', description='The unit of the subscription duration. Valid values: Month and Year. This parameter is valid only for an instance that uses the subscription billing method.

This parameter is required.', example='Month'),
  regionId?: string(name='RegionId', description='The ID of the region.

This parameter is required.', example='cn-shanghai'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
}

model RenewTSDBInstanceResponseBody = {
  orderId?: long(name='OrderId', description='The ID of the order.', example='100000000000000'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='57540985-3C11-4588-96FD-93413C6282EF'),
}

model RenewTSDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RenewTSDBInstanceResponseBody(name='body'),
}

/**
 * @param request RenewTSDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RenewTSDBInstanceResponse
 */
async function renewTSDBInstanceWithOptions(request: RenewTSDBInstanceRequest, runtime: Util.RuntimeOptions): RenewTSDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.duration)) {
    query['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pricingCycle)) {
    query['PricingCycle'] = request.pricingCycle;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RenewTSDBInstance',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request RenewTSDBInstanceRequest
 * @return RenewTSDBInstanceResponse
 */
async function renewTSDBInstance(request: RenewTSDBInstanceRequest): RenewTSDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return renewTSDBInstanceWithOptions(request, runtime);
}

model RestartHiTSDBInstanceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='ts-ufxxxxxxxxxxxxxx'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
}

model RestartHiTSDBInstanceResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='1556DCB0-043A-4444-8BD9-CF4A68E7EE64'),
}

model RestartHiTSDBInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RestartHiTSDBInstanceResponseBody(name='body'),
}

/**
 * @summary Restarts a Time Series Database (TSDB) instance.
 *
 * @param request RestartHiTSDBInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RestartHiTSDBInstanceResponse
 */
async function restartHiTSDBInstanceWithOptions(request: RestartHiTSDBInstanceRequest, runtime: Util.RuntimeOptions): RestartHiTSDBInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RestartHiTSDBInstance',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Restarts a Time Series Database (TSDB) instance.
 *
 * @param request RestartHiTSDBInstanceRequest
 * @return RestartHiTSDBInstanceResponse
 */
async function restartHiTSDBInstance(request: RestartHiTSDBInstanceRequest): RestartHiTSDBInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return restartHiTSDBInstanceWithOptions(request, runtime);
}

model SwitchHiTSDBInstancePublicNetRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='ts-ufxxxxxxxxxxxxxx'),
  ownerAccount?: string(name='OwnerAccount'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  securityToken?: string(name='SecurityToken'),
  switchAction?: long(name='SwitchAction', description='*   **1**: enables access to the instance from the Internet.
*   **0**: disables access to the instance from the Internet.

This parameter is required.', example='1'),
}

model SwitchHiTSDBInstancePublicNetResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='EC6A17BC-B326-4626-B3BE-932B003DB3A9'),
}

model SwitchHiTSDBInstancePublicNetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SwitchHiTSDBInstancePublicNetResponseBody(name='body'),
}

/**
 * @summary Switches the Internet connection status of a Time Series Database (TSDB) instance.
 *
 * @param request SwitchHiTSDBInstancePublicNetRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SwitchHiTSDBInstancePublicNetResponse
 */
async function switchHiTSDBInstancePublicNetWithOptions(request: SwitchHiTSDBInstancePublicNetRequest, runtime: Util.RuntimeOptions): SwitchHiTSDBInstancePublicNetResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ownerAccount)) {
    query['OwnerAccount'] = request.ownerAccount;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.securityToken)) {
    query['SecurityToken'] = request.securityToken;
  }
  if (!Util.isUnset(request.switchAction)) {
    query['SwitchAction'] = request.switchAction;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SwitchHiTSDBInstancePublicNet',
    version = '2017-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Switches the Internet connection status of a Time Series Database (TSDB) instance.
 *
 * @param request SwitchHiTSDBInstancePublicNetRequest
 * @return SwitchHiTSDBInstancePublicNetResponse
 */
async function switchHiTSDBInstancePublicNet(request: SwitchHiTSDBInstancePublicNetRequest): SwitchHiTSDBInstancePublicNetResponse {
  var runtime = new Util.RuntimeOptions{};
  return switchHiTSDBInstancePublicNetWithOptions(request, runtime);
}

